<template>
	<view style="width: 100vw;height: 100vh;">
		<input style="border-radius: 36rpx;border: 1rpx solid #ccc;width: 70%;margin: auto;margin-top: 50rpx;padding: 20rpx;" type="number" placeholder="手机号" v-model="shoujihao"/>
		<input  style="border-radius: 36rpx;border: 1rpx solid #ccc;width: 70%;margin: auto;margin-top: 50rpx;padding: 20rpx;" type="safe-password" placeholder="密码" v-model="mima"/>
		<view class="">
			<button @click="butlogin" style="width: 70%;margin: auto;margin-top: 50rpx;border-radius: 36rpx;border: 1rpx solid #ccc;height: 100rpx;background-color: aquamarine;">登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mima:null,
				shoujihao:null
			};
		},
		methods:{
			butlogin(){
				console.log(uni.getStorageSync('token'))
				this.$request({
					url:'/dev-api/login',
					method:'POST',
					data:{
						// username:this.shoujihao,
						// password:this.mima,
						username:'14711738125',
						password:'123456'
					}
				}).then(res=>{
					uni.setStorageSync('token',res.token)
					console.log(res.token)
					this.$request({
						url:'/dev-api/getInfo',
						method:'GET',
						header:{
							Authorization:uni.getStorageSync('token')
						}
					}).then(res=>{
						uni.setStorageSync('carid',res.cars[0].carId)
					})
				})
			}
		},
		onLoad() {

		}
	}
</script>

<style lang="scss">

</style>
